package Students;

import java.util.ArrayList;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        ArrayList<Student> arr = new ArrayList<>();
        Student st = new Student();
        Student st1 = new Student();
        Student st2 = new Student();
        Student st3 = new Student();
        Student st4 = new Student();
        st = AddDelete();
        st1 = AddDelete();
        st2 = AddDelete();
        st3 = AddDelete();
        st4 = AddDelete();
        arr.add(st);
        arr.add(st1);
        arr.add(st2);
        arr.add(st3);
        arr.add(st4);
        StudentOp sp = new StudentOp(arr);
        for (int j = 0; j < 5; j++) {
            arr.get(j).String();
        }
        while (true) {
            System.out.println("请输入你需要用的功能：");
            String s = sc.next();
            switch (s) {
                case "添加":
                    sp.add();
                    break;
                case "修改":
                    sp.modify();
                    break;
                case "查询":
                    sp.select();
                    break;
                case "删除":
                    sp.delete();
                    break;
            }
            if(s.equals(" ")){
                break;
            }
        }
    }

    public static Student AddDelete() {
        Scanner sc = new Scanner(System.in);
        Student st1 = new Student();
        System.out.println("请输入姓名：");
        String name = sc.next();
        st1.setName(name);
        System.out.println("请输入年龄：");
        int age = sc.nextInt();
        st1.setAge(age);
        System.out.println("请输入性别：");
        String sex = sc.next();
        st1.setSex(sex);
        System.out.println("请输入联系方式：");
        String tele = sc.next();
        st1.setTelephone(tele);
        System.out.println("请输入学号：");
        int num = sc.nextInt();
        st1.setNumber(num);
        return st1;
    }
}
